package com.binance.mbxgateway.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import com.binance.master.models.APIRequest;
import com.binance.master.models.APIResponse;
import com.binance.mbxgateway.api.IKlineApi;
import com.binance.mbxgateway.vo.request.klines.GetKlineRequest;
import com.binance.mbxgateway.vo.response.klines.GetKlinesResponse;
import com.binance.mbxgateway.web.service.IKlineService;

@RestController
public class KlineController implements IKlineApi {

    @Autowired
    private IKlineService klineService;

    /**
     * 
     */
    @Override
    public APIResponse<GetKlinesResponse> getKlines(@RequestBody @Validated APIRequest<GetKlineRequest> request)
            throws Exception {
        return APIResponse.getOKJsonResult(this.klineService.getKline(request.getBody()));
    }

}
